<template>
    <div id='' class='system_set_form'>
        <i-form ref="iForm" :config="config">
        </i-form>
    </div>
</template>
<script>
import { config } from './form_config'
export default {
    name: '',
    props: [''],
    data() {
        this.newConfig = icu.util.deepClone(config)
        return {
            config: this.newConfig,
            sort: 1,
        };
    },
    components: {},
    computed: {},
    beforeMount() { },
    mounted() { },
    methods: {
        getForm(cb) {
            this.$refs.iForm.submit('dictionaryAddUpdata', (res) => {
                this.formData = this.returnData(res);
                this.$http.$post('SaveDictionaryType', { data: this.formData }).then(res => {
                    if (res.code == 200) {
                        this.$Message.success('保存成功');
                        if (cb) {
                            cb(this.formData)
                        }
                        return
                    }
                    this.$Message.error(res.msg)
                })
            })
        },
        setData(row) {
            this.$http.$get('InfoDictionaryType', { params: { id: row.id } }).then(res => {
                if (res.code == 200) {
                    this.$refs.iForm.setData({
                        ...this.returnData(res.data)
                    })
                    return
                }
                this.$Message.error(res.msg);
            })
        },
        returnData(res) {
            return {
                dictName: res.dictName ? res.dictName : '',
                dictType: res.dictType ? res.dictType : '',
                remarks: res.remarks ? res.remarks : '',
                id: res.id ? res.id : '',
                sort: res.sort,
            }
        },
    },
    watch: {}
}
</script>
<style lang='less' scoped>
</style>
